package com.cy.wangly.rest.vo;

import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Map;

public class TestVO {
    private String name;
    private List<String> listValue;
    private Map<String,String> stringMap;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<String> getListValue() {
        return listValue;
    }

    public void setListValue(List<String> listValue) {
        this.listValue = listValue;
    }

    public Map<String, String> getStringMap() {
        return stringMap;
    }

    public void setStringMap(Map<String, String> stringMap) {
        this.stringMap = stringMap;
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("TestVO{").append("name='" + name + "'");
         if(!CollectionUtils.isEmpty(listValue)){
             sb.append(", listValue=[");
             for (String s : listValue) {
                 sb.append(s+",");
             }
             sb.deleteCharAt(sb.length()-1);
             sb.append("]");
         }
        if(!CollectionUtils.isEmpty(listValue)){
            sb.append(", stringMap=[");
            stringMap.forEach((k,v)->
                sb.append("{"+k+","+v+"}")
            );
            sb.append("]");
        }
        return sb.toString();
    }
}
